/*
 * Lenovo Group
 * Copyright (c) 2015-2016 All Rights Reserved.
 * 
 * Project Name:assign-tracer
 * Create Time: 2016年1月21日 下午4:53:32
 */
package com.lenovo.lmrp.server.assigntracer.util.pusher;

import java.util.LinkedList;

/**
 * 
 * @author songyz TODO 微信推送消息 未完成，后期需要新增
 */
public class WechartSernder implements ISender {

	private static WechartSernder wechartSernder;
	//private static final Logger logger = LoggerFactory.getLogger(GeTuiSender.class);
	private LinkedList<PushParameter> pushParameterList = new LinkedList<PushParameter>();

//	public void run() {
//		PushParameter pushParameter;
//		synchronized (wechartSernder) {
//			pushParameter = this.pushParameterList.getFirst();
//			this.pushParameterList.removeFirst();
//		}
//		SendMessage(pushParameter);
//	}

	public void SendMessage(PushParameter PushParameter) {
		// 调用客服接口发送消息，每天上限

		// 获取Access_token

		// 通过POST调用
		// https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
		// 传递JSON参数 {access_token:令牌,touser:openId,msgtype:消息类型,content:消息内容}

	}
	
	/* (non-Javadoc)
	 * @see com.lenovo.lmrp.server.assigntracer.util.pusher.ISender#retryPushMessage(com.lenovo.lmrp.server.assigntracer.util.pusher.PushParameter)
	 */
	@Override
	public void retryPushMessage(PushParameter pushParameter) {
	    // TODO Auto-generated method stub
	    
	}

	public Runnable addMessageToList(PushParameter msParameter) {
//		this.pushParameterList.addLast(msParameter);
		return new pushMessage(msParameter);
	}
	
	private class pushMessage implements Runnable {
        
        private PushParameter msParameter;
        
        public pushMessage(PushParameter msParameter) {
            this.msParameter = msParameter;
        }
        @Override
        public void run() {
            SendMessage(msParameter);
        }
    }

}
